package com.apes.fico.finance.model.gl;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @program: GLVoucherBatchDel
 * @description: 财务凭证批量删除
 * @author: ZhengZeXian
 * @create: 2022年3月14日15:28:58
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = GLVoucherBatchDel.CONST_TABLE_NAME)
public class GLVoucherBatchDel extends Model {
    public final static String CONST_TABLE_NAME = "gl_voucher_batch_del";

    @Id
    @Column(name = "id", nullable = false, length = 120)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "财务凭证")
    @Comment("编码")
    private String id;

    @NotNull
    @Column
    @Comment("会计期间")
    private String period;

    @NotNull
    @Column
    @Comment("会计年度")
    private int year;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "company_id", referencedColumnName = "id", nullable = false)
    @Comment("公司")
    private PartyRole company;

    @Comment("凭证模板")
    @Column(name = "voucher_template_id")
    private String voucherTemplateId;

    @NotNull
    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "start_date")
    @Comment("开始日期")
    private Date startDate;

    @NotNull
    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "end_date")
    @Comment("结束日期")
    private Date endDate;

}
